USE [HomestayWebDB]
GO
/****** Object:  StoredProcedure [dbo].[Store_House_GetHouseOrdinateAndPostTitle]    Script Date: 12/16/2012 12:31:56 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[Store_House_GetHouseOrdinateAndPostTitle]
	@Province int
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	SELECT p.PostID,
		   p.Title,
		   h.HouseID,
		   h.Ordinate,
		   h.PricePerDay,
		   h.PricePerMonth,
		   h.PricePerWeek,
		   p.PostAvatar,
		   p.IsAvailable,
		   t.Name as TypeOfHouse
	FROM Houses h, Posts p, TypeOfHouses t
	WHERE h.Province = @Province 
		  AND p.HouseID = h.HouseID 
		  AND h.TypeOfHouseID = t.TypeOfHouseID 
		  AND p.IsDeleted = 'False'
		  AND p.PostStatus =1
	ORDER BY p.PostID ASC
END
